<template>
  <div class="sidebar-logo-container" :class="{ collapse: collapse }">
    <transition name="sidebarLogoFade">
      <router-link v-if="collapse" key="collapse" class="sidebar-logo-link" to="/">
<!--        <img src="@/assets/logo/logo.png" class="sidebar-logo">-->
        <h1 class="sidebar-title pl10">{{ title }}</h1>
      </router-link>
      <router-link v-else key="expand" class="sidebar-logo-link" to="/">
<!--        <img src="@/assets/logo/logo.png" class="sidebar-logo">-->
        <span>
          <h1 class="sidebar-title pl10">{{ title }}</h1>
        </span>
      </router-link>
    </transition>
  </div>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
  name: 'SidebarLogo',
  props: {
    collapse: {
      type: Boolean,
      required: true
    }
  },
  computed: {
    ...mapGetters(['logo', 'isLdap']),
    title() {
      const currentApp = JSON.parse(localStorage.getItem('currentApp'))
      return currentApp.name
    }
  },
  methods: {
    getSystemSettings() {
      // this.$store.dispatch('settings/getSystemSettings')
    }
  }
}

</script>
<style lang="scss" scoped>
.sidebarLogoFade-enter-active {
  transition: opacity 1.5s;
}

.sidebarLogoFade-enter,
.sidebarLogoFade-leave-to {
  opacity: 0;
}

.sidebar-logo-container {
  position: relative;
  width: 100%;
  height: 60px;
  line-height: 60px;
  background: #277fd6;
  text-align: center;
  overflow: hidden;

  & .sidebar-logo-link {
    height: 100%;
    width: 100%;
    display: flex;
    align-items: center;

    & .sidebar-logo {
      width: 38px;
      height: 38px;
      vertical-align: middle;
      margin-right: 2px;
      background: #fff;
      border-radius: 50%
    }

    & .sidebar-title {
      display: inline-block;
      margin: 0;
      color: #fff;
      font-weight: 600;
      line-height: 60px;
      font-size: 20px;
      vertical-align: middle;
      margin-right: 10px;
    }
  }

  &.collapse {
    .sidebar-logo {
      margin-right: 0px;
    }
  }
}

</style>
